<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>Loader (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>

  <script type="text/javascript" src="//www.google.com/jsapi"></script>
  <script type="text/javascript">
     google.load("visualization", "1", {packages:["orgchart"]});
     var _loadingVisualizations = true;
  </script>

  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
        <span class="fn">module.Loader</span>
        <span>Extends</span>
        <span class="fn-name">
          
        </span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    The dynamic loading functionality is defined as a class. The class
will be used as singleton. There is, however, a two step
initialization procedure because parameters need to be passed to
the goog.module.Loader instance.


  </div>


        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="local_closure_goog_module_loader.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/local/closure/goog/module/loader.js">Git</a></li>
          </ol>
        </div>
</div>






<h2 class="g-first">Inheritance</h2>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
  <tr><td>goog.module.Loader</td><td></td></tr>
</table>
</div>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
</table>
</div>




  <h2>Constructor</h2>
      <div class="fn-constructor">
    goog.module.Loader(<span></span>)
  </div>



<h2>Instance Methods</h2>


  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_module_Loader.html">
              goog.module.Loader
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.module.Loader.prototype.getModuleUrl_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">getModuleUrl_<span class="args">(<span class="arg">urlBase</span>,&nbsp;<span class="arg">module</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Creates a full URL to the compiled module code given a base URL and a
module name. By default it's urlBase + '_' + module + '.js'.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">urlBase</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">URL to the module files.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">module</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">Module name.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            The full url to the module binary.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line99">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.module.Loader.prototype.init"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">init<span class="args">(<span class="arg">baseUrl</span>,&nbsp;<span class="arg">opt_urlFunction</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Initializes the Loader to be fully functional. Also executes load
requests that were received before initialization. Must be called
exactly once, with the URL of the base library. Module URLs are
derived from the URL of the base library by inserting the module
name, preceded by a period, before the .js prefix of the base URL.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">baseUrl</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The URL of the base library.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_urlFunction</span>
        : <span class="type">Function=</span>
        <div class="entryOverview">Function that creates the URL for the
    module file. It will be passed the base URL for module files and the
    module name and should return the fully-formed URL to the module file to
    load.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line143">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.module.Loader.prototype.load_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">load_<span class="args">(<span class="arg">module</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Starts to load a module. Assumes that init() was called.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">module</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The name of the module.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line241">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.module.Loader.prototype.provide"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">provide<span class="args">(<span class="arg">module</span>,&nbsp;<span class="arg">opt_symbol</span>,&nbsp;<span class="arg">opt_object</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Registers a symbol in a loaded module. When called without symbol,
registers the module to be fully loaded and executes all callbacks
from pending require() callbacks for this module.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">module</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The name of the module. Cf. parameter module
    of method require().</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_symbol</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span><span>&nbsp;|&nbsp;</span><span class="type">string=</span>
        <div class="entryOverview">The symbol being defined, or nothing when
    all symbols of the module are defined. Cf. parameter symbol of method
    require().</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">opt_object</span>
        : <span class="type">Object=</span>
        <div class="entryOverview">The object bound to the symbol, or nothing when
    all symbols of the module are defined.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line211">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.module.Loader.prototype.require"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">require<span class="args">(<span class="arg">module</span>,&nbsp;<span class="arg">symbol</span>,&nbsp;<span class="arg">callback</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Requests the loading of a symbol from a module. When the module is
loaded, the requested symbol will be passed as argument to the
function callback.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">module</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The name of the module. Usually, the value
    is defined as a constant whose name starts with MOD_.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">symbol</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span><span>&nbsp;|&nbsp;</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The ID of the symbol. Usually, the value is
    defined as a constant whose name starts with SYM_.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">callback</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function">Function</a></span>
        <div class="entryOverview">This function will be called with the
    resolved symbol as the argument once the module is loaded.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line175">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>




<h2>Instance Properties</h2>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_module_Loader.html">
              goog.module.Loader
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.module.Loader.prototype.modules_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">modules_</span>
        : 
     </div>


     <div class="entryOverview">
       Provides associative access to each module and the symbols of each module
that have aready been loaded (one lookup for the module, another lookup
on the module for the symbol).

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line58">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.module.Loader.prototype.pendingBeforeInit_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">pendingBeforeInit_</span>
        : 
     </div>


     <div class="entryOverview">
       Array of modules that have been requested before init() was called.
If require() is called before init() was called, the required
modules can obviously not yet be loaded, because their URL is
unknown. The modules that are requested before init() are
therefore stored in this array, and they are loaded at init()
time.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line86">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.module.Loader.prototype.pendingModuleUrls_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">pendingModuleUrls_</span>
        : 
     </div>


     <div class="entryOverview">
       Map of module name to module url. Used to avoid fetching the same URL
twice by keeping track of in-flight URLs.
Note: this allows two modules to be bundled into the same file.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line67">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.module.Loader.prototype.pending_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">pending_</span>
        : 
     </div>


     <div class="entryOverview">
       Map of module name/array of {symbol name, callback} pairs that are pending
to be loaded.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line49">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.module.Loader.prototype.urlBase_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryName">urlBase_</span>
        : 
     </div>


     <div class="entryOverview">
       The base url to load modules from. This property will be set in init().

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line74">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>




<h2>Static Methods</h2>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.module.Loader.getInstance"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.module.Loader.</span><span class="entryName">getInstance<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line42">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.module.Loader.loaderEval_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.module.Loader.</span><span class="entryName">loaderEval_<span class="args">(<span class="arg">t_</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Loads the module by evaluating the javascript text in the current
scope. Uncompiled, base identifiers are visible in the global scope;
when compiled they are visible in the closure of the anonymous
namespace. Notice that this cannot be replaced by the global eval,
because the global eval isn't in the scope of the anonymous
namespace function that the jscompiled code lives in.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">t_</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The javascript text to evaluate. IMPORTANT: The
  name of the identifier is chosen so that it isn't compiled and
  hence cannot shadow compiled identifiers in the surrounding scope.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line125">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>



<h2>Static Properties</h2>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.module.Loader.LOAD_CALLBACK"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.module.Loader.</span><span class="entryName">LOAD_CALLBACK</span>
        : 
     </div>


     <div class="entryOverview">
       The globally exported name of the load callback. Matches the
definition in the js_modular_binary() BUILD rule.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line109">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.module.Loader.instance_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.module.Loader.</span><span class="entryName">instance_</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_module_loader.js.source.html#line42">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package module</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="module.Loader"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
